File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
pkg/compiler/lib/src/js_emitter/startup_emitter Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -1260,19 +1260,24 @@ class FragmentEmitter {
1260
1260
for (Library library in fragment.libraries) {
1261
1261
for (Class cls in library.classes) {
1262
1262
if (cls.isSoftDeferred != softDeferred) continue ;
1263
+ bool firstAlias = true ;
1263
1264
for (InstanceMethod method in cls.methods) {
1264
1265
if (method.aliasName != null ) {
1265
- assignments.add (js.js.statement ('#.prototype.# = #.prototype.#' , [
1266
- classReference (cls),
1267
- js.quoteName (method.aliasName),
1268
- classReference (cls),
1269
- js.quoteName (method.name)
1270
- ]));
1266
+ if (firstAlias) {
1267
+ firstAlias = false ;
1268
+ assignments.add (js.js.statement (
1269
+ assignments.isEmpty
1270
+ ? 'var _ = #.prototype;'
1271
+ : '_ = #.prototype' ,
1272
+ classReference (cls)));
1273
+ }
1274
+ assignments.add (js.js.statement ('_.# = _.#' ,
1275
+ [js.quoteName (method.aliasName), js.quoteName (method.name)]));
1271
1276
}
1272
1277
}
1273
1278
}
1274
1279
}
1275
- return new js. Block ( assignments);
1280
+ return wrapPhase ( 'aliases' , assignments);
1276
1281
}
1277
1282
1278
1283
/// Encodes the optional default values so that the runtime Function.apply
You can’t perform that action at this time.
0 commit comments