perf(dart/transform) Restructure transform to independent phases

Update summary:
- Removes the need for resolution, gaining transform speed at the cost
  of some precision and ability to detect errors
- Generates type registrations in the package alongside their declarations
- Ensures that line numbers do not change in transformed user code
This commit is contained in:
Tim Blasi
2015-02-27 14:42:21 -08:00
parent 08bd3a4443
commit d0aceef4e0
52 changed files with 1530 additions and 318 deletions
@@ -0,0 +1,27 @@
library bar;
import 'bar.dart';
import 'package:angular2/src/core/annotations/annotations.dart';
bool _visited = false;
void setupReflection(reflector) {
if (_visited) return;
_visited = true;
reflector
..registerType(MyComponent, {
"factory": () => new MyComponent(),
"parameters": const [],
"annotations": const [
const Component(selector: 'soup', componentServices: const [ToolTip])
]
})
..registerType(ToolTip, {
"factory": () => new ToolTip(),
"parameters": const [],
"annotations": const [
const Decorator(
selector: '[tool-tip]', bind: const {'text': 'tool-tip'})
]
})
..registerSetters({"text": (ToolTip o, String value) => o.text = value});
}
@@ -1,26 +0,0 @@
library angular2.src.transform.generated;
import 'package:angular2/src/reflection/reflection.dart' show reflector;
import 'bar.dart' as i0;
import 'package:angular2/src/core/annotations/annotations.dart' as i1;
setupReflection() {
reflector
..registerType(i0.MyComponent, {
"factory": () => new i0.MyComponent(),
"parameters": const [const []],
"annotations": const [
const i1.Component(
selector: 'soup', componentServices: const [i0.ToolTip])
]
})
..registerType(i0.ToolTip, {
"factory": () => new i0.ToolTip(),
"parameters": const [const []],
"annotations": const [
const i1.Decorator(
selector: '[tool-tip]', bind: const {'text': 'tool-tip'})
]
})
..registerSetters({"text": (i0.ToolTip o, String value) => o.text = value});
}