Skip to content

Commit cc3e97a

Browse files
committed
Merge branch 'ShyykoSerhiy-3454'
2 parents c17934e + 4cd7f07 commit cc3e97a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/compiler/emitter.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4215,10 +4215,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
42154215
}
42164216
}
42174217

4218+
let startIndex = 0;
4219+
42184220
write(" {");
42194221
scopeEmitStart(node, "constructor");
42204222
increaseIndent();
42214223
if (ctor) {
4224+
// Emit all the directive prologues (like "use strict"). These have to come before
4225+
// any other preamble code we write (like parameter initializers).
4226+
startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true);
42224227
emitDetachedComments(ctor.body.statements);
42234228
}
42244229
emitCaptureThisForNodeIfNecessary(node);
@@ -4253,7 +4258,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
42534258
if (superCall) {
42544259
statements = statements.slice(1);
42554260
}
4256-
emitLines(statements);
4261+
emitLinesStartingAt(statements, startIndex);
42574262
}
42584263
emitTempDeclarations(/*newLine*/ true);
42594264
writeLine();

tests/baselines/reference/strictModeInConstructor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ var A = (function () {
7474
var B = (function (_super) {
7575
__extends(B, _super);
7676
function B() {
77-
this.s = 9;
7877
"use strict"; // No error
78+
this.s = 9;
7979
_super.call(this);
8080
}
8181
return B;

0 commit comments

Comments
 (0)