From a03f06f76662eeba619b46dd0080e566aff527d6 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 23 Nov 2015 14:39:41 -0800 Subject: [PATCH] add strict mdoe directive to all nones6 module emits --- src/compiler/emitter.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 998c9540928..e4d685597e7 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -7383,6 +7383,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(`], function(${exportFunctionForFile}) {`); writeLine(); increaseIndent(); + emitUseStrictPrologueDirective(); const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); @@ -7493,6 +7494,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi writeModuleName(node, emitRelativePathAsModuleName); emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName); increaseIndent(); + emitUseStrictPrologueDirective(); const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); @@ -7505,6 +7507,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitCommonJSModule(node: SourceFile) { + emitUseStrictPrologueDirective(); const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); emitEmitHelpers(node); collectExternalModuleInfo(node); @@ -7515,6 +7518,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitExportEquals(/*emitAsReturn*/ false); } + function emitUseStrictPrologueDirective() { + writeLine(); + write("\"use strict\";"); + } + function emitUMDModule(node: SourceFile) { emitEmitHelpers(node); collectExternalModuleInfo(node); @@ -7534,6 +7542,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi })(`); emitAMDFactoryHeader(dependencyNames); increaseIndent(); + emitUseStrictPrologueDirective(); const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node);