feat(dart/transform): Use the best available Change Detectors

Enable pregenerated (for Dart) and JIT (for Js) change detectors when
possible. Previously we would always use `DynamicChangeDetector`s, but
these cause megamorphic calls and are therefore much slower.

Closes #502
This commit is contained in:
Tim Blasi
2015-05-29 16:34:51 -07:00
parent 21dcfc89e9
commit 8e3bf3907a
24 changed files with 215 additions and 96 deletions
@@ -22,8 +22,6 @@ void initReflector(reflector) {
..registerType(HelloCmp, {
'factory': () => new HelloCmp(),
'parameters': const [const []],
'annotations': const [
const Component(changeDetection: 'CHECK_ONCE')
]
'annotations': const [const Component(changeDetection: 'CHECK_ONCE')]
});
}
@@ -22,8 +22,6 @@ void initReflector(reflector) {
..registerType(HelloCmp, {
'factory': () => new HelloCmp(),
'parameters': const [const []],
'annotations': const [
const Component(events: ['onFoo', 'onBar'])
]
'annotations': const [const Component(events: ['onFoo', 'onBar'])]
});
}
@@ -20,6 +20,8 @@ void initReflector(reflector) {
const View(template: 'Salad')
]
});
_gen.preGeneratedProtoDetectors['MyComponent_comp_0'] =
_MyComponent_ChangeDetector0.newProtoChangeDetector;
}
class _MyComponent_ChangeDetector0 extends _gen.AbstractChangeDetector {
final dynamic _dispatcher;