mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
Avoid introducing js.Parameters in constructor body
Use the Parameter name in the template so that it is converted into a VariableUse. This change fixes some double-counting in the function parameter / local variable minifier which made the --fast-startup constructors 'miss' using some minified names. I believe the 'missed' names is a regression. Saves 50k (0.4%) on one large app. Change-Id: Ib7597f5c474ef285b082697e368667dbac23931b Reviewed-on: https://dart-review.googlesource.com/30720 Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: Stephen Adams <sra@google.com>
This commit is contained in:
parent
2930223f13
commit
72736aff0d
|
@ -756,15 +756,15 @@ class FragmentEmitter {
|
|||
for (Field field in cls.fields) {
|
||||
js.Parameter parameter = new js.Parameter('t${parameters.length}');
|
||||
parameters.add(parameter);
|
||||
statements
|
||||
.add(js.js.statement('#.# = #', [thisRef, field.name, parameter]));
|
||||
statements.add(
|
||||
js.js.statement('#.# = #', [thisRef, field.name, parameter.name]));
|
||||
}
|
||||
|
||||
if (cls.hasRtiField) {
|
||||
js.Parameter parameter = new js.Parameter('t${parameters.length}');
|
||||
parameters.add(parameter);
|
||||
statements.add(js.js
|
||||
.statement('#.# = #', [thisRef, namer.rtiFieldJsName, parameter]));
|
||||
statements.add(js.js.statement(
|
||||
'#.# = #', [thisRef, namer.rtiFieldJsName, parameter.name]));
|
||||
}
|
||||
|
||||
return js.js('function #(#) { # }', [name, parameters, statements]);
|
||||
|
|
|
@ -287,7 +287,6 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
|
|||
Statement toStatement(item) {
|
||||
if (item is Statement) return item;
|
||||
if (item is Expression) return item.toStatement();
|
||||
;
|
||||
return error('Interpolated value #$nameOrPosition is not '
|
||||
'a Statement or List of Statements: $value');
|
||||
}
|
||||
|
@ -368,7 +367,6 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
|
|||
if (value is bool) return value;
|
||||
if (value is Expression) return value;
|
||||
if (value is String) return convertStringToVariableUse(value);
|
||||
;
|
||||
error('Interpolated value #$nameOrPosition '
|
||||
'is not an Expression: $value');
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue