-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Closed
Labels
Description
Normalize string / No interpolation
- Replace
interpolate1 = "" "${componentName0 == null ? "" : componentName0}" ""withinterpolate1 = " " + stringify(componentName0) + " ";NOTE: will require import ofstringifymethod. I think${}creates extra unneeded checks, so simple string concat+should be better in this case.
Inline assignments
- take advantage of multiple assignments per line.
``` Dart``
_componentName0 = _gen.ChangeDetectionUtil.uninitialized();
_interpolate1 = _gen.ChangeDetectionUtil.uninitialized();
_directive_1_0 = _gen.ChangeDetectionUtil.uninitialized();
_directive_2_0 = _gen.ChangeDetectionUtil.uninitialized();
becomes:
``` Dart
_componentName0 = _interpolate1 = _directive_1_0 = _directive_2_0
= _gen.ChangeDetectionUtil.uninitialized;
- Also call
dehydrateDirectives()from constructor so that we don't have to duplicate the code in the constructor.
Inline assignments and usages
- inline where ever possible.
_dispatcher.notifyOnBinding(currentProto.bindingRecord, interpolate1);
_interpolate1 = interpolate1;becomes
_dispatcher.notifyOnBinding(currentProto.bindingRecord, _interpolate1 = interpolate1);have notifyOnBinding helper
- create
viewSetin super. Notice that_dispatcheris always a View. This code is no longer abstract so we should use concrete names.
currentProto = _protos[1]
...
change_interpolate1 = true;
_dispatcher.notifyOnBinding(currentProto.bindingRecord, interpolate1);
_interpolate1 = interpolate1;becomes
change_interpolate1 = viewSet(1, _interpolate1 = interpolate1);which requires this method on superclass
boolean viewSet(int index, dynamic value) {
_view.notifyOnBinding(protos[index].bindingRecord, value);
return true;
}looseNotIdentical
- have
loseNotIdenticalwhich will allow us to changeif (!_gen.looseIdentical(...))toif (_gen.looseNotIdentical(...)). (its only one char, but it is everywhere)
inline context assignment
var context = null;
context = _context;should be
var context = _context;Unused change_context
- the code is never used in output
var change_context = false;but is never read.
change uninitialized() method call to uninitialized static field
- should save some chars