feat(dart/change_detect): Add type to ChangeDetector context

Add a type for the `context` field in Dart's pre-generated change
detectors. This requires slight changes to set the dehydrated value of
`context` to `null` rather than `ChangeDetectionUtil.uninitialized()`,
which was its former dehydrated state.

Mirror these chagnes as closely as possible in the
`ChangeDetectionJITGenerator` to allow easier maintenance.

Closes #2070
This commit is contained in:
Tim Blasi
2015-06-04 15:53:16 -07:00
parent 851797aecb
commit 529805508a
5 changed files with 44 additions and 27 deletions
@@ -27,7 +27,7 @@ class _MyComponent_ChangeDetector0 extends _gen.AbstractChangeDetector {
final _gen.List<_gen.ProtoRecord> _protos;
final _gen.List<_gen.DirectiveRecord> _directiveRecords;
dynamic _locals = null;
dynamic _context = _gen.ChangeDetectionUtil.uninitialized();
MyComponent _context = null;
_MyComponent_ChangeDetector0(this._dispatcher, this._pipeRegistry,
this._protos, this._directiveRecords)
@@ -45,19 +45,18 @@ class _MyComponent_ChangeDetector0 extends _gen.AbstractChangeDetector {
void callOnAllChangesDone() {}
void hydrate(context, locals, directives) {
void hydrate(MyComponent context, locals, directives) {
mode = 'ALWAYS_CHECK';
_context = context;
_locals = locals;
}
void dehydrate() {
_context = _gen.ChangeDetectionUtil.uninitialized();
_context = null;
_locals = null;
}
hydrated() =>
!_gen.looseIdentical(_context, _gen.ChangeDetectionUtil.uninitialized());
hydrated() => _context == null;
static _gen.ProtoChangeDetector newProtoChangeDetector(
_gen.PipeRegistry registry, _gen.ChangeDetectorDefinition def) {