-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dart/transform): Handle edge cases in ReflectionRemover
Handle some cases which would previously result in broken code. - Importing bootstrap.dart deferred - Using combinators when importing bootstrap.dart - Importing bootstrap.dart with a prefix Closes #6749
- Loading branch information
Showing
6 changed files
with
121 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...les_dart/transform/test/transform/reflection_remover/combinator_files/expected/index.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
library angular2.test.transform.reflection_remover.combinator_files; | ||
|
||
// This file is intentionally formatted as a string to avoid having the | ||
// automatic transformer prettify it. | ||
// | ||
// This file represents transformed user code. Because this code will be | ||
// linked to output by a source map, we cannot change line numbers from the | ||
// original code and we therefore add our generated code on the same line as | ||
// those we are removing. | ||
|
||
var code = """ | ||
import 'package:angular2/bootstrap_static.dart' show bootstrapStatic, initReflector;import 'index.ng_deps.dart' as ngStaticInit; | ||
void main() { | ||
bootstrapStatic(MyComponent, null, () { ngStaticInit.initReflector(); }); | ||
} | ||
"""; |
5 changes: 5 additions & 0 deletions
5
modules_dart/transform/test/transform/reflection_remover/combinator_files/index.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'package:angular2/bootstrap.dart' show bootstrap; | ||
|
||
void main() { | ||
bootstrap(MyComponent); | ||
} |
19 changes: 19 additions & 0 deletions
19
.../transform/test/transform/reflection_remover/deferred_bootstrap_files/expected/index.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
library angular2.test.transform.reflection_remover.deferred_bootstrap_files; | ||
|
||
// This file is intentionally formatted as a string to avoid having the | ||
// automatic transformer prettify it. | ||
// | ||
// This file represents transformed user code. Because this code will be | ||
// linked to output by a source map, we cannot change line numbers from the | ||
// original code and we therefore add our generated code on the same line as | ||
// those we are removing. | ||
|
||
var code = """ | ||
import 'package:angular2/bootstrap_static.dart' deferred as ng;import 'index.ng_deps.dart' as ngStaticInit; | ||
void main() { | ||
ng.loadLibrary().then((_) { | ||
ng.bootstrapStatic(MyComponent, null, () { ngStaticInit.initReflector(); }); | ||
}); | ||
} | ||
"""; |
7 changes: 7 additions & 0 deletions
7
modules_dart/transform/test/transform/reflection_remover/deferred_bootstrap_files/index.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import 'package:angular2/bootstrap.dart' deferred as ng; | ||
|
||
void main() { | ||
ng.loadLibrary().then((_) { | ||
ng.bootstrap(MyComponent); | ||
}); | ||
} |