File tree 1 file changed +16
-0
lines changed 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -5311,6 +5311,21 @@ const _super = (function (geti, seti) {
5311
5311
emitSignatureParameters ( ctor ) ;
5312
5312
}
5313
5313
else {
5314
+ // The ES2015 spec specifies in 14.5.14. Runtime Semantics: ClassDefinitionEvaluation:
5315
+ // If constructor is empty, then
5316
+ // If ClassHeritag_eopt is present and protoParent is not null, then
5317
+ // Let constructor be the result of parsing the source text
5318
+ // constructor(...args) { super (...args);}
5319
+ // using the syntactic grammar with the goal symbol MethodDefinition[~Yield].
5320
+ // Else,
5321
+ // Let constructor be the result of parsing the source text
5322
+ // constructor( ){ }
5323
+ // using the syntactic grammar with the goal symbol MethodDefinition[~Yield].
5324
+ //
5325
+ // While we could emit the '...args' rest parameter, certain later tools in the pipeline might
5326
+ // downlevel the '...args' portion less efficiently by naively copying the contents of 'arguments' to an array.
5327
+ // Instead, we'll avoid using a rest parameter and spread into the super call as
5328
+ // 'super(...arguments)' instead of 'super(...args)', as you can see below.
5314
5329
write ( "()" ) ;
5315
5330
}
5316
5331
}
@@ -5349,6 +5364,7 @@ const _super = (function (geti, seti) {
5349
5364
write ( "_super.apply(this, arguments);" ) ;
5350
5365
}
5351
5366
else {
5367
+ // See comment above on using '...arguments' instead of '...args'.
5352
5368
write ( "super(...arguments);" ) ;
5353
5369
}
5354
5370
emitEnd ( baseTypeElement ) ;
You can’t perform that action at this time.
0 commit comments